local game = require "club.threecard.blackjack"

local croupier = game.ui.element();

croupier.instance = nil;

function croupier:ctor()
    self.res = "club.threecard.blackjack/ui/ingame.b:croupier"
end

function croupier:say(content, time)
    self:show();
    time = time or 1;
    self.content_txt.text = content;

    self.timer_id = game.gamelib.timer.start(function()
        self.timer_id = nil
        self:hide();
    end, time);
end

function croupier.tip(content, time)
    if not croupier.instance then
        return;
    end

    croupier.instance:say(content, time);
end

function croupier:clear_scene()
    self:hide()
    if self.timer_id then   
        game.gamelib.timer.stop(self.timer_id)
        self.timer_id = nil
    end
end

return croupier